package com.qww.factory.demo1;

public class OrderPizza {

    private Pizza pizza;

    public void order(OrderType orderType) {
        switch (orderType) {
            case CHEESE_PIZZA:
                pizza = new CheesePizza(OrderType.CHEESE_PIZZA);
                System.out.println("order cheese");
                break;
            case GREEK_PIZZA:
                pizza = new GreekPizza(OrderType.GREEK_PIZZA);
                System.out.println("order green");
                break;
            default:
                break;
        }
        pizza.prepare();
        pizza.bake();
        pizza.cut();
        pizza.box();
    }

    public OrderPizza(OrderType orderType) {
        order(orderType);
    }

}
